package com.edgclub.edg.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.edgclub.edg.R;
import com.edgclub.edg.adapter.adapteruitls.GzBaseAdapter;
import com.edgclub.edg.adapter.adapteruitls.MyItemClickListener;
import com.edgclub.edg.adapter.adapteruitls.MyItemLongClickListener;
import com.edgclub.edg.adapter.adapteruitls.RViewHolder;
import com.edgclub.edg.model.Topic;
import com.rockerhieu.emojicon.EmojiconTextView1;

import java.util.ArrayList;

/**
 */
public class MessChatAdapter extends GzBaseAdapter{
    private ArrayList<Topic> datas = null;
    private Context context;

    public MessChatAdapter(Context context) {
        this.context = context;
    }

    //创建新View，被LayoutManager所调用
    @Override
    public MessChatAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_message_chat,viewGroup,false);
        ViewHolder vh = new ViewHolder(view,mListener,mLongClickListener);
        return vh;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

    }


    //获取数据的数量
    @Override
    public int getItemCount() {
        return 5;
//        return datas.size();
    }

    public ArrayList<Topic> getDatas() {
        return datas;
    }

    public void setDatas(ArrayList<Topic> datas) {
        this.datas = datas;
    }




    //自定义的ViewHolder，持有每个Item的的所有界面元素
    public static class ViewHolder extends RViewHolder {
        private ImageView mUser_icon;
        private TextView name;
        private EmojiconTextView1 mess;
        private TextView time,mess_nosee;
        public ViewHolder(View view, MyItemClickListener listener, MyItemLongClickListener longClickListener){
            super(view, listener, longClickListener);
            mUser_icon = (ImageView) view.findViewById(R.id.user_icon);
            name = (TextView) view.findViewById(R.id.name);
            mess = (EmojiconTextView1) view.findViewById(R.id.peoplejs);
            time = (TextView) view.findViewById(R.id.pull_text);
            mess_nosee = (TextView) view.findViewById(R.id.mess_nosee);
        }
    }

}
